﻿<!DOCTYPE html>
<html>
<!-- 我的培训课程 -->

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>

</head>

<body>

    <div id="app" v-cloak>
        <el-form label-position="right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
                 style="margin-bottom: 15px;">
            <el-row>
                <el-col class="head-tool">

                    <div class="new_title fl"><strong><img src="/static/images/icon1.png" />我的培训课程列表</strong></div>
                    <span>
                        <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3" @click="onSubmit">
                        </btn>
                        <btn-export-list url="xxxx" :forminline="this.formInline" linetype="4"></btn-export-list>
                    </span>
                </el-col>
            </el-row>
            <el-row>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item prop="year">
                            <div class="elst-select-mini" style="margin-left: 0px">
                                {{'培训年度'+mark.m}}
                                <el-date-picker slot="suffix" v-model="formInline.model.year" type="year" size="mini" format="yyyy"
                                                value-format="yyyy" placeholder="选择年度">
                                </el-date-picker>
                            </div>
                        </el-form-item>

                    </div>
                </el-col>
                <!--培训时间开始-->
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{'培训开始时间开始'+mark.m}}
                                </template>
                                <el-date-picker v-model="formInline.model.trainingdateStart" type="date" slot="suffix"
                                                value-format="yyyy-MM-dd" size="mini" placeholder="选择日期">
                                </el-date-picker>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <!--培训时间结束-->
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{'培训开始时间结束'+mark.m}}
                                </template>
                                <el-date-picker v-model="formInline.model.trainingdateEnd" type="date" slot="suffix"
                                                value-format="yyyy-MM-dd" size="mini" placeholder="选择日期">
                                </el-date-picker>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6" style="margin-bottom:0px">
                    <div class="elst-select-mini fl">
                        目前积分为 {{'5'}} 分 {{'2020'}} 年目标积分为 10 分
                    </div>
                </el-col>

            </el-row>
        </el-form>
        <el-table ref="table" stripe :data="ListItem.tableData" :row-key="getRowKeys" :height="ListItem.tableHeight" border
                  @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%;">
            <el-table-column type="selection" style="
                padding-top: 0px;
                padding-bottom: 0px;
" align="center" width="45" :reserve-selection="true">
            </el-table-column>
            <el-table-column type="index" :label="col.SequenceNumber" :index="indexMethod" width="50"
                             show-overflow-tooltip="true"></el-table-column>
            <!--培训计划-->
            <el-table-column prop="nameoftrainingplan" label="培训计划" min-width="100" show-overflow-tooltip="true">
            </el-table-column>
            <!--培训目标-->
            <el-table-column prop="mark02" label="课程名称" min-width="100" show-overflow-tooltip="true">
            </el-table-column>
            <!--培训类型
    <el-table-column prop="trainingmodeText" label="培训方式" min-width="80" show-overflow-tooltip="true">
    </el-table-column>
    <!--培训时间-->
            <el-table-column prop="trainingdate" label="培训开始时间" min-width="110" show-overflow-tooltip="true" :formatter="myformatDate">
            </el-table-column>
            <!--培训时间-->
            <el-table-column prop="trainingdate" label="培训结束时间" min-width="110" show-overflow-tooltip="true" :formatter="myformatDate">
            </el-table-column>

            <!--培训老师-->
            <el-table-column prop="mark01" label="培训讲师" min-width="80" show-overflow-tooltip="true">
            </el-table-column>

            <!--满分-->
            <el-table-column prop="fullmarks" label="满分" min-width="80" show-overflow-tooltip="true">
            </el-table-column>

            <!--合格分数-->
            <el-table-column prop="qualificationscore" label="合格分数" min-width="80" show-overflow-tooltip="true">
            </el-table-column>

            <!--是否合格--来自人员-->
            <el-table-column prop="mark03" label="是否合格" min-width="80" show-overflow-tooltip="true">
            </el-table-column>

            <!--状态-->
            <el-table-column prop="stateText" label="计划状态" min-width="80" show-overflow-tooltip="true">
            </el-table-column>
            <!--是否参与-->
            <el-table-column prop="mark04" label="是否参与" min-width="80" show-overflow-tooltip="true">
            </el-table-column>
            <!--是否讲师-->
            <el-table-column prop="mark05" label="是否讲师" min-width="80" show-overflow-tooltip="true">
            </el-table-column>
            <!--得分-->
            <el-table-column prop="mark06" label="得分" min-width="50" show-overflow-tooltip="true">
            </el-table-column>
            <!-- <el-table-column width="53" :label="col.btndetails" fixed="right">
        <template slot-scope="scope">
            <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id)>
                <i class="el-icon-tickets"></i>
            </button>
        </template>
    </el-table-column> -->

            <el-table-column width="80" label="在线学习" fixed="right">
                <template slot-scope="scope">
                    <button type="button" class="elst-bt-xg" @click=PX('xg',scope.row.tsId,scope.row.trainingmodeText,scope.row.stateText,scope.row.mark07,scope.row.id,scope.row.mark03)>
                        <i class="el-icon-tickets"></i>
                    </button>
                </template>
            </el-table-column>

            <el-table-column width="80" :label="'考试详情'" fixed="right">
                <template slot-scope="scope">
                    <button type="button" class="elst-bt-xg" @click="UserInputStatistics('',scope.row.id)">
                        <i class="el-icon-tickets"></i>
                    </button>
                </template>
            </el-table-column>
            <!--<el-table-column width="90" align=center :label="'模拟考试'" fixed="right">
        <template slot-scope="scope">
            <button type="button" class="elst-bt-xg" @click="UserInput('mn',scope.row.id)">
                <i class="el-icon-tickets"></i>
            </button>
        </template>
    </el-table-column>-->
            <!--<el-table-column width="90" align=center :label="'在线考试'" fixed="right">
        <template slot-scope="scope">
            <button type="button" class="elst-bt-xg" @click="UserInput('zx',scope.row.id,scope.row.trainingmodeText,scope.row.stateText,scope.row.mark03)">
                <i class="el-icon-tickets"></i>
            </button>
        </template>
    </el-table-column>-->


        </el-table>
        <el-row type="flex" justify="end" style="margin-top:10px;">
            <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                           :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                           :layout="ListItem.layout" :total="ListItem.total">
            </el-pagination>
        </el-row>

        <!-- 弹出页 -->
        <!--<el-dialog title="我的培训课程-详情" fullscreen="true" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="80%"
                   top="10vh">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>-->
        <el-dialog :title="mytitle" fullscreen="true" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%" height="80%"
                   top="10vh">
            <div align="right">
                <table>
                    <tr>
                        <td>
                            <!--<btn :text="'模拟考试'" linetype="1" @click="UserInput('mn',ztid5)">-->
                            <button type="button" class="el-button el-button--primary" @click="UserInput('mn',ztid5)"><span>模拟考试</span></button>
                        </td>
                        <td>&nbsp;&nbsp;</td>
                        <td>
                            <!--<btn :text="'在线考试'" linetype="1" @click="UserInput('zx',ztid5,ztype2,zstate3,zthg6)">-->
                            <button type="button" class="el-button el-button--primary" @click="UserInput('zx',ztid5,ztype2,zstate3,zthg6)"><span>在线考试</span></button>
                        </td>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
                    </tr>
                </table>
            </div>
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:100%;width:100%" frameborder="0"></iframe>
        </el-dialog>

    </div>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                mytitle: '',
                value1: '',
                //带参数
                zid11: '',// 计划id
                ztype2: '',//培训方式
                zstate3: '',//培训计划状态
                zurl4: '',//课件地址
                ztid5: '',//培训考试人员表ZB_ExamUser的id
                zthg6: '',//是否合格(合格 不合格);

                //表单内容
                ListItem: ListItem,
                //获取下拉菜单situation
                //department: [],
                formInline: {
                    model: {
                        year: ''
                        //, trainingdateStart: ''
                        //, trainingdateEnd: ''
                        //, nameoftrainingplan: ''
                        //, qualificationscore: ''
                        //, trainingmode:''
                    },
                    offset: 0,
                    limit: 10
                },
            },
            created: function () {
                //var currApp = this;
                //window.onresize = function () {
                //    currApp.ListItem.tableHeight = window.innerHeight -
                //        currApp.$refs.table.$el.offsetTop - 60;
                //    if (currApp.ListItem.tableHeight < 112) {
                //        currApp.ListItem.tableHeight = 112;
                //    }
                //}
            },
            mounted: function () {

                var tmpDate = new Date();
                var year = tmpDate.getFullYear();
                //alert(year);
                this.formInline.model.year = year.toString();// '2020'
                //this.formInline.model.trainingmode='1'//取 1 线上 培训方式 1 线上  2 线下
                //初始化数据
                this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },
                //关闭Dialog 回调
                closeDialog: function () { closeDialog(this); },
                //删除方法
                onDelete: function () { onDelete(this, '/api/Addingtraininginformation/DeleteMuti'); },
                //列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //获取分页数据
                //GetPageData: function (currentIndex) {
                //    //GetPageData(this, currentIndex, '/api/ZB_TrainPlan/GetList')
                //    alert('xxxxxx');
                //    GetPageData(this, currentIndex,'/api/ZB_TrainPlan/WDKSGetList')
                //    //console.log("xxxxxx", this.formInline);
                //},
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/ZB_TrainPlan/WDKSGetList') },
                //查询方法
                onSubmit: function () { onSubmit(this); },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },
                //获取下拉菜单数据
                getDropDown: function () {
                },
                //跳转到详情页，当前id为ZB_ExamUser的id
                UserInputStatistics: function (val, id) {
                    //alert(id);
                    DialogShow(this, val, "OnlineExaminationDetailsInput.html", id);
                },
                //Dialog展示
                //UserInput: function (val, id) { DialogShow(this, val, "AddingtraininginformationInput.html", id); },
                UserInput: function (val, id, s1, s2, s3) {
                    if (val == 'mn') {
                        this.mytitle = '模拟考试';
                        this.ListItem.InputUrl = "OnlineexaminationInput.html?id=" + id + "&type=0&t=" + Date.parse(new Date());
                    }
                    else {
                        this.mytitle = '在线考试';
                        if (s1 != '线上' || s2 != '进行中' || s3 == '合格') {
                            showMessage('当前状态下无法进行在线考试！', 'error')
                            return;
                        }
                        this.ListItem.InputUrl = "OnlineexaminationInput.html?id=" + id + "&type=1&t=" + Date.parse(new Date());
                    }

                    this.ListItem.dialogVisible = true;
                    //DialogShow(this, val, "OnlineExaminationInput.html", id);
                },
                PX: function (val, zid, ztype, zstate, zurl, ztid, zthg) {
                    //zid: 计划id
                    //ztype:培训方式
                    //zstate:培训计划状态
                    //zurl:课件地址
                    //ztid: 培训考试人员表ZB_ExamUser的id
                    //zthg:是否合格(合格 不合格);
                    if (ztype == '线下') {
                        showMessage("请参与线下培训！", "error")
                        return;
                    }
                    if (zstate != '进行中') {
                        showMessage("培训进行中状态才能参与培训！", "error")
                        return;
                    }

                    if (zthg == '合格') {
                        showMessage("已合格不需要再培训！", "error")
                        return;
                    }


                    this.mytitle = '线上培训';
                    //this.timercz(zid);

                    this.ListItem.InputUrl = zurl;
                    this.ListItem.dialogVisible = true;

                    this.zid11 = zid;// 计划id
                    this.ztype2 = ztype;//培训方式
                    this.zstate3 = zstate;//培训计划状态
                    this.zurl4 = zurl;//课件地址
                    this.ztid5 = ztid;//培训考试人员表ZB_ExamUser的id
                    this.zthg6 = zthg;//是否合格(合格 不合格);

                },
                //////////////////////////////////////////////////////////////////////////////
            }
        });
    </script>
</body>

</html>